<template>
  <div class="personal">
    <OrderHeader title="个人中心">
      <template v-slot:tip>
        <span>温馨提示：产品是否购买成功，以最终下单为准哦，请尽快结算</span>
      </template>
    </OrderHeader>
    <div class="wrapper">
      <div class="container">
        <div class="card-box">
          <div>
            <div class="portal-main clearfix">
              <div class="user-card">
                <h2 class="username">{{usermessage.name}}</h2>
                <p class="tip">
                  下午好
                </p>
                <a class="link">修改信息</a>
                <img src="https://cdn.cnbj1.fds.api.mi-img.com/user-avatar/458fcebd-9789-4128-b5e6-dd79d4b94155.jpg"
                     width="150" height="150" class="avatar">
              </div>
              <div class="user-actions">
                <ul class="action-list">
                  <li>账户安全:&nbsp;<span class="level level-3">较高</span></li>
                  <li>绑定手机:&nbsp;<span class="level level-3">{{usermessage.tel}}</span></li>
                  <li>绑定邮箱:&nbsp;<span class="level level-3">{{usermessage.email}}</span></li>

                </ul>

              </div>

            </div>
            <div class="portal-sub">
              <ul class="info-list">
                <li class="info-list-li">
                  <h3>待支付的订单:<span class="num">{{ordermessage.TobepaidCount}}</span></h3>
                  <a @click="$router.push({path:'/order/list',query:{status:1}})" class="status">查看待支付的订单></a>
                  <img src="https://s01.mifile.cn/i/user/portal-icon-1.png">
                </li>
                <li class="info-list-li">
                  <h3>待收货的订单:<span class="num">{{ordermessage.ForthegoodsCount}}</span></h3>
                  <a @click="$router.push({path:'/order/list',query:{status:4}})" class="status">查看待收货的订单:></a>
                  <img src="https://s01.mifile.cn/i/user/portal-icon-2.png">
                </li>
                <li class="info-list-li">
                  <h3>我的小法庭:<span class="num">0</span></h3>
                  <a @click="$router.push({path:'/tribunal/TribunalTab/myTribunal'})" class="status">查看小法庭:></a>
                  <img src="https://s01.mifile.cn/i/user/portal-icon-3.png">
                </li>
                <li class="info-list-li">
                  <h3>喜欢的商品:<span class="num">0</span></h3>
                  <a>查看喜欢的商品:></a>
                  <img src="https://s01.mifile.cn/i/user/portal-icon-4.png">
                </li>


              </ul>

            </div>

          </div>


        </div>


      </div>

    </div>
    <nav-footer></nav-footer>
  </div>

</template>

<script>
  import NavFooter from './../components/NavFooter'
  import OrderHeader from "../components/OrderHeader";

  export default {
    name: "personal",
    data() {
      return {
        usermessage: {},
        ordermessage:{
          TobepaidCount:0,
          ForthegoodsCount:0
        }
      }

    },
    components: {OrderHeader, NavFooter},
    created() {
      this.initData()
    },
    methods: {
      initData() {
        this.$axios.get('/user/getUserInfo', {params: {name: sessionStorage.getItem("username")}}).then((res) => {
          this.usermessage = res.user
          //待支付总数
          this.$axios.get('/orders/getorderlist', {
            params: {
              // pageSize: 10,
              // pageNum: this.pageNum,
              username: sessionStorage.getItem("username"),
              statusDesc: "未支付"
            }
          }).then((res) => {
            this.ordermessage.TobepaidCount=res.list.length

          })
          //获取待收货总数
          this.$axios.get('/orders/getorderlist', {
            params: {
              // pageSize: 10,
              // pageNum: this.pageNum,
              username: sessionStorage.getItem("username"),
              statusDesc: "待收货"
            }
          }).then((res) => {
            this.ordermessage.ForthegoodsCount=res.list.length
          })

        })

      }
    }


  }
</script>

<style scoped>
  .wrapper {
    background-color: #F5F5F5;
    padding-top: 30px;
    padding-bottom: 114px;
  }
.status{
  cursor: pointer;
}
.status:hover{
  color: #007AFF;
}
.num{
  color: #FF6600;
}
  .portal-sub img {
    position: absolute;
    left: -10px;
    top: -10px;
  }

  .container {
    width: 1126px;
    margin: auto auto;
  }

  .info-list {
    margin: 0;
    padding: 60px 0 0;
    list-style-type: none;
    color: #757575;
  }

  .info-list-li {
    position: relative;
    float: left;
    width: 276px;
    height: 65px;
    padding-left: 112px;
    padding-top: 15px;
    margin-left: 14px;
    margin-bottom: 80px;

  }

  .card-box {
    margin-top: 10px;
    background-color: #ffffff;
    min-height: 600px;
    font-size: 14px;
    padding: 36px 48px;
    color: #999999;

  }

  .user-card {
    position: relative;
    float: left;
    width: 302px;
    height: 160px;
    padding-left: 180px;
    padding-top: 40px;
  }

  .username {
    font-weight: 400;
    color: #616161;
    font-size: 24px;
    margin: 0;
  }

  .tip {
    margin: 0 0 10px;
    color: #b0b0b0;
  }

  .link {
    font-size: 12px;
    color: #ff6700;
  }

  .avatar {

    position: absolute;
    left: 0;
    top: 0;
    padding: 4px;
    border: 1px solid #e0e0e0;
    border-radius: 150px;
  }

  .portal-main {
    padding-top: 24px;
    height: 200px;
  }

  .user-actions {
    float: right;
    margin-top: 35px;
    width: 358px;
  }

  .action-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
    color: #757575;
  }

  .action-list li {
    padding: 6px 0;


  }

  .level {
    color: #83c44e;
  }

  li {
    position: relative;
    /*padding: 6px 0;*/
  }

  .portal-sub {
    border-top: 1px solid #e0e0e0;
    padding: 0px 100px;

  }
</style>
